/*
 *  flexchain.h
 *  EPPI-0.0
 *
 *  Created by Juan Carlos Garcia Orden on 22/01/08.
 *
 */
 
#ifndef _flexchain_h_
#define _flexchain_h_

#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <sstream>
#include "mecsystem.h"
#include "body.h"
#include "point.h"
#include "COMPONENTS/particle.h"
//#include "consdis1.h"
//#include "truss1.h"
#include "COMPONENTS/truss.h"

class MecSystem;

using namespace std;

class FlexChain : public Body
{
public:
	vector<double> firstP;	/** Coords of first end point */
	vector<double> secondP;	/** Coords of second end point */
	string matName;	/** Material */
	double area;			/** area of the section */
	vector< vector<string> > connectSurface; // Connectivity matrix of the segments
/*	Data members from the base class Body
	string name;
	int dim;
	MecSystem* parentSystem;
	vector<Component*> vComponents;
	vector<Component*> vLoads;
	vector<string> vPointNamesSurface;
	vector<Point*> vPPointSurface;
	map<string,int,less<string> > pNamePNumber;
	string outGraphFilex;
	ofstream localFGraph;
	vector<vector<double> > vLocalPoints;	// Local points, for joints and contact
*/

public:
	FlexChain(){}
	FlexChain(ifstream &, string, MecSystem*);
	~FlexChain(){}
	
	/** Virtual functions from base */
	void setPTPointsComp();		/** Set pointers to points in each component */
	void setPTPointsLoad();		/** Set pointers to points in each load */
	void setPPointSurface();
	void setMatAtComp();
	void getBoundary(vector<vector<string> >&);
//	void writeFileGraph(ofstream&, string&);	/** Write graphical output to file */
	void writeMSH(ofstream&);
	void writeVTU(ofstream&, bool&, bool&, bool&);		
	void writeOOGL(ofstream&);
	void writeFileTemp(const double&, ofstream &);
	void setIniPosBody(vector<double>&);
	
	/** Local functions */
	
};

#endif
